'''
Constants, copy from sys/event.h
'''

EVFILT_READ         = (-1)
EVFILT_WRITE        = (-2)
EVFILT_AIO          = (-3)    # attached to aio requests
EVFILT_VNODE        = (-4)    # attached to vnodes
EVFILT_PROC         = (-5)    # attached to struct proc
EVFILT_SIGNAL       = (-6)    # attached to struct proc
EVFILT_TIMER        = (-7)    # timers
EVFILT_MACHPORT     = (-8)    # Mach ports
EVFILT_FS           = (-9)    # Filesystem events

EVFILT_SYSCOUNT     = 9
EVFILT_THREADMARKER = EVFILT_SYSCOUNT # Internal use only

# actions
EV_ADD     = 0x0001          # add event to kq (implies enable)
EV_DELETE  = 0x0002          # delete event from kq
EV_ENABLE  = 0x0004          # enable event
EV_DISABLE = 0x0008          # disable event (not reported)
EV_RECEIPT = 0x0040          # force EV_ERROR on success, data == 0

# flags
EV_ONESHOT = 0x0010          # only report one occurrence
EV_CLEAR   = 0x0020          # clear event state after reporting

EV_SYSFLAGS = 0xF000         # reserved by system
EV_FLAG0    = 0x1000         # filter-specific flag
EV_FLAG1    = 0x2000         # filter-specific flag

# returned values
EV_EOF   = 0x8000            # EOF detected
EV_ERROR = 0x4000            # error, data contains errno

# Filter specific flags for EVFILT_READ
EV_POOL   = EV_FLAG0
EV_OOBAND = EV_FLAG1

# data/hint fflags for EVFILT_{READ|WRITE}
NOTE_LOWAT = 0x00000001               # low water mark

# data/hint fflags for EVFILT_VNODE, shared with userspace
NOTE_DELETE = 0x00000001              # vnode was removed
NOTE_WRITE  = 0x00000002              # data contents changed
NOTE_EXTEND = 0x00000004              # size increased
NOTE_ATTRIB = 0x00000008              # attributes changed
NOTE_LINK   = 0x00000010              # link count changed
NOTE_RENAME = 0x00000020              # vnode was renamed
NOTE_REVOKE = 0x00000040              # vnode access was revoked

# data/hint fflags for EVFILT_PROC, shared with userspace
NOTE_EXIT      = 0x80000000           # process exited
NOTE_FORK      = 0x40000000           # process forked
NOTE_EXEC      = 0x20000000           # process exec'd
NOTE_REAP      = 0x10000000           # process reaped
NOTE_SIGNAL    = 0x08000000           # shared with EVFILT_SIGNAL
NOTE_PDATAMASK = 0x000fffff           # mask for pid/signal
NOTE_PCTRLMASK = (~NOTE_PDATAMASK)

# data/hint fflags for EVFILT_TIMER, shared with userspace.
NOTE_SECONDS  = 0x00000001            # data is seconds
NOTE_USECONDS = 0x00000002            # data is microseconds
NOTE_NSECONDS = 0x00000004            # data is nanoseconds
NOTE_ABSOLUTE = 0x00000008            # absolute timeout
